from shapely.geometry import Polygon

from ship_envs.core.eitity import Entity


class Range(object):
    def __init__(self):
        self.range = Polygon([(0, 0), (1, 0), (1, 1), (0, 1)])

    def out_range(self, entity):
        if isinstance(entity, Entity):
            return not self.range.contains(entity.get_collision_model().gemo)
        return False
